package com.hdax.dmw.base.controller;

import com.hdax.dmw.base.DmImage;
import com.hdax.dmw.base.service.DmImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(path = "/base")
public class DmImageController {

    @Autowired
    private DmImageService imageService;

    @Value("${server.port}")
    private String port;

    @PostMapping(path = "/image")
    public DmImage image(
            @RequestParam("targetId") Long targetId,
            @RequestParam("type") Integer type,
            @RequestParam("category") Integer category
    ){
        System.out.println("当前base服务端口号："+port);
        return imageService.getImage(targetId, type, category);
    }
}
